package router

import (
	"github.com/gin-gonic/gin"
	"mojieshi/admin"
	"mojieshi/middlewares"
	"mojieshi/service"
)

func Router() *gin.Engine {
	r := gin.Default()
	r.Use(middlewares.Cors())
	//小程序端
	// 用户注册/登入
	r.POST("/user/app/login", service.WXlogin)
	// 修改用户所在城市
	r.POST("/app/user/edit_city", middlewares.AuthToken(), service.EditUserCity)
	//获取用户地址列表
	r.POST("/user/app/addressList", service.GetAddList)
	//// 地址新增/修改
	r.POST("/user/app/addOrEditAddress", service.AddEditAddress)
	//// 修改默认地址
	r.POST("/app/address/edit", middlewares.AuthToken(), service.EditAddress)
	//// 删除地址
	r.POST("/app/address/del", middlewares.AuthToken(), service.AddressDel)
	// // 获取商品栏目
	r.POST("/app/cate/list", service.GetCate)
	// 获取商品分组信息
	r.POST("/app/group/list", service.GetShopGroupList)
	// 获取分组商品及信息
	r.POST("/app/group/info", service.GetGroupInfo)
	// 获取商品列表
	r.POST("/app/fu_shop/list", service.GetFuShopList)
	// 获取分组下商品列表
	r.POST("/app/fu_group_shop/list", service.GetFuGroupList)
	//// 获取历史搜索
	r.POST("/app/search/list", service.GetSearch)
	//新增历史搜索
	r.POST("/app/search/add", service.AddSearch)
	// 获取热门搜索
	r.POST("/app/hto_search/list", service.GetHotSearch)
	// 热门搜索+1
	r.POST("/app/hto_search/add", service.AddHotSearch)
	// 搜索结果
	r.POST("/app/hto_search/show", service.GetSearchShow)
	// 获取商品列表
	r.POST("/app/shop_product/list", service.GetShopList)
	// 获取二级分类与商品列表
	r.POST("/app/shop_cate_product/list", service.GetShopCateList)
	// // 获取商品详情页
	r.POST("/app/shop/info", service.GetShopProductInfo)
	// // 获取服务详情页
	r.POST("/app/fu_wu/info", service.GetFuProductInfo)
	//获取文章主分类
	r.POST("/app/article/getlist", service.GetArticleCategoryList)
	//获取文章分类
	r.POST("/app/article/list", service.ArticleCategoryList)
	//获取文章
	r.POST("/app/articleContent/list", service.ArticleList)
	//文章详情
	r.POST("/app/article/show", service.GetArticleShow)
	//新增阅读量
	r.POST("/app/article/add_yue", service.AddYuedu)
	// 获取支付列表
	r.POST("/app/pay/list", service.PayList)
	// 获取充值设置
	r.POST("/app/recharge/list", service.GetRecharge)
	// 余额充值下单
	r.POST("/app/recharge_order/add", middlewares.AuthToken(), service.AddRecharge)
	// 调用微信小程序apiv3支付
	r.POST("/app/wx_pay/WxPayV3Api", middlewares.AuthToken(), service.PayOrderByWxMini)
	// 调用微信小程序apiv3支付回调
	r.POST("/app/wx_pay/WxPayV3ApiNotifyUrl", service.PayWXMiniCallback)
	//获取用户详情
	r.POST("/user/app/userInfo", middlewares.AuthToken(), service.UserInfo)
	// // 获取确认订单信息
	r.POST("/app/shop_order/info", middlewares.AuthToken(), service.GetConfirmarShopOrder)
	// // 获取确认服务订单信息
	r.POST("/app/fu_wu_order/info", middlewares.AuthToken(), service.GetConfirmarFuOrder)
	// // 创建订单服务订单
	r.POST("/app/fu_wu_order/add", middlewares.AuthToken(), service.AddFuOrder)
	// // 余额支付
	r.POST("/app/pay_order/pay", middlewares.AuthToken(), service.RechargeEdit)
	//修改用户头像、昵称、手机号
	r.POST("/user/app/setUserInfo", middlewares.AuthToken(), service.SetUser)
	//获取手机号
	r.POST("/user/app/getWXPhone", middlewares.AuthToken(), service.GetWXPhone)
	//充值卡兑换
	r.POST("/app/recharge_exchange/exchange", middlewares.AuthToken(), service.RechargeExchange)
	//获取余额明细
	r.POST("/app/recharge/show", middlewares.AuthToken(), service.GetRechargeShow)
	//获取积分明细
	r.POST("/app/score/show", middlewares.AuthToken(), service.GetScoreShow)
	//获取优惠券
	r.POST("/app/coupon/list", middlewares.AuthToken(), service.GetCoupon)
	//领取优惠券
	r.POST("/app/coupon/add", middlewares.AuthToken(), service.ReceiveCoupon)
	//获取我的优惠券
	r.POST("/app/coupon/my_list", middlewares.AuthToken(), service.GetMyCouponList)
	// 获取服务订单list
	r.POST("/app/fu_order/list", middlewares.AuthToken(), service.GetOrderList)
	// 取消服务订单
	r.POST("/app/fu_order/cancel", middlewares.AuthToken(), service.CancelFuOrder)
	// 删除服务订单
	r.POST("/app/fu_order/del", middlewares.AuthToken(), service.DelFuOrder)
	// 服务订单详情
	r.POST("/app/fu_order/show", middlewares.AuthToken(), service.GetFuOrderShow)
	// 关闭订单
	r.GET("/app/fu_order/close", service.CloseFuOrder)
	// 关闭预约
	r.GET("/app/yuyue_order/close", service.CloseYuYue)
	// 激活套餐
	r.POST("/app/fu_order/activation", middlewares.AuthToken(), service.ActivationFuOrder)
	// 获取服务套餐list
	r.POST("/app/tao_order/list", middlewares.AuthToken(), service.GetFuWuTaoList)
	// 确认预约服务
	r.POST("/app/tao_order/confirmar", middlewares.AuthToken(), service.GetFuYueConfirmar)
	// 预约下单
	r.POST("/app/xiang_order/Add", middlewares.AuthToken(), service.AddFuwuYu)
	// 获取服务清单列表
	r.POST("/app/xiang_order/list", middlewares.AuthToken(), service.GetFuYuList)
	// 获取预约详情
	r.POST("/app/xiang_order/show", middlewares.AuthToken(), service.GetFuYuShow)
	// 修改预约
	r.POST("/app/xiang_order/edit", middlewares.AuthToken(), service.EditFuYu)
	// 取消预约
	r.POST("/app/xiang_order/cancel", middlewares.AuthToken(), service.CancelFuwuYu)
	// 领取套餐
	r.POST("/app/xiang_order/give", middlewares.AuthToken(), service.GiveFuOrder)
	// 获取我的预约服务
	r.POST("/app/xiang_order/getList", middlewares.AuthToken(), service.GetYueList)
	// 获取意见列表
	r.POST("/app/opinion/list", middlewares.AuthToken(), service.GetOpinionList)
	// 新增意见反馈
	r.POST("/app/opinion/add", middlewares.AuthToken(), service.AddOpinion)

	//后台
	//后台登入
	r.POST("/user/admin/login", admin.Login)
	//获取等级list
	r.POST("/user/group/list", middlewares.AuthTokenAdmin(), admin.UserAdminGroup)
	//等级Add/edit
	r.POST("/user/group/add_or_edit", middlewares.AuthTokenAdmin(), admin.UserAdminGroupAdd)
	//删除等级
	r.POST("/user/group/del", middlewares.AuthTokenAdmin(), admin.UserAdminGroupDel)
	//管理员list
	r.POST("/user/user_admin/list", middlewares.AuthTokenAdmin(), admin.UserAdminList)
	//管理员Add/edit
	r.POST("/user/user_admin/add_or_edit", middlewares.AuthTokenAdmin(), admin.UserAdminAdd)
	//删除管理员
	r.POST("/user/user_admin/del", middlewares.AuthTokenAdmin(), admin.UserAdminDel)
	//获取管理员的详情
	r.POST("/user/admin/info", middlewares.AuthTokenAdmin(), admin.UserInfo)
	//操作日志
	r.POST("/admin/journal/list", middlewares.AuthTokenAdmin(), admin.JournalLogList)
	//权限添加
	r.POST("/admin/rolt/edit_or_add", middlewares.AuthTokenAdmin(), admin.RoltEditAdd)
	//菜单列表
	r.GET("/menu/list", middlewares.AuthTokenAdmin(), admin.MenuList)
	//首页菜单列表
	r.GET("/menu/index/list", middlewares.AuthTokenAdmin(), admin.MenuListIndex)
	//菜单Add/edit
	r.POST("/menu/add_or_edit", middlewares.AuthTokenAdmin(), admin.MenuAdd)
	//删除菜单
	r.POST("/menu/del", middlewares.AuthTokenAdmin(), admin.MenuDel)
	//菜单排序
	r.POST("/menu/sort", middlewares.AuthTokenAdmin(), admin.MenuSort)
	// 设置语言环境
	r.POST("/user/admin/set_language", middlewares.AuthTokenAdmin(), admin.SetLanguage)
	//获取会员等级
	r.POST("/admin/level/list", middlewares.AuthTokenAdmin(), admin.LevelList)
	//会员等级排序
	r.POST("/admin/level/Sort", middlewares.AuthTokenAdmin(), admin.LevelSort)
	// 新增/修改会员等级
	r.POST("/admin/level/add_or_edit", middlewares.AuthTokenAdmin(), admin.LevelAdd)
	//删除会员等级
	r.POST("/admin/level/del", middlewares.AuthTokenAdmin(), admin.LevelDel)
	//获取会员
	r.POST("/admin/member/list", middlewares.AuthTokenAdmin(), admin.MemberList)
	// 修改会员
	r.POST("/admin/member/add_or_edit", middlewares.AuthTokenAdmin(), admin.MemberEdit)
	//删除会员
	r.POST("/admin/member/del", middlewares.AuthTokenAdmin(), admin.MemberDel)
	//获取banner
	r.POST("/admin/banner/list", admin.BannerList)
	// 新增/修改banner
	r.POST("/admin/banner/add_or_edit", middlewares.AuthTokenAdmin(), admin.BannerAdd)
	//删除banner
	r.POST("/admin/banner/del", middlewares.AuthTokenAdmin(), admin.BannerDel)
	//修改banner图片
	r.POST("/admin/banner/edit", middlewares.AuthTokenAdmin(), admin.AddBannerList)
	//获取页面列表
	r.POST("/admin/appPage/list", middlewares.AuthTokenAdmin(), admin.AppPageList)
	//获取金刚区
	r.POST("/admin/jinGang/list", admin.JinGangList)
	//金刚区排序
	r.POST("/admin/jinGang/Sort", middlewares.AuthTokenAdmin(), admin.JinGangSort)
	// 新增/修改金刚区
	r.POST("/admin/jinGang/add_or_edit", middlewares.AuthTokenAdmin(), admin.JinGangAdd)
	//删除金刚区
	r.POST("/admin/jinGang/del", middlewares.AuthTokenAdmin(), admin.JinGangDel)
	//获取系统基本设置
	r.POST("/admin/admin_set/info", admin.GetAdminSet)
	//设置基础信息
	r.POST("/admin/admin_set/edit", middlewares.AuthTokenAdmin(), admin.EditAdminSet)
	// 阿里云oss上传
	r.POST("/admin/aliyun/upload", admin.AliyunUpload)
	//获取金刚区栏目
	r.POST("/admin/jinGangCate/list", admin.JinGangCateList)
	// 新增/修改金刚区栏目
	r.POST("/admin/jinGangCate/add_or_edit", middlewares.AuthTokenAdmin(), admin.JinGangCateAdd)
	//删除金刚区栏目
	r.POST("/admin/jinGangCate/del", middlewares.AuthTokenAdmin(), admin.JinGangCateDel)
	//获取分类
	r.POST("/admin/shopCate/list", middlewares.AuthTokenAdmin(), admin.ShopCateList)
	//分类排序
	r.POST("/admin/shopCate/Sort", middlewares.AuthTokenAdmin(), admin.CateGorySort)
	// 新增/修改商品分类
	r.POST("/admin/shopCate/add_or_edit", middlewares.AuthTokenAdmin(), admin.CateGoryAdd)
	//删除商品分类
	r.POST("/admin/shopCate/del", middlewares.AuthTokenAdmin(), admin.CateGoryDel)
	//获取分组
	r.POST("/admin/shopGroup/list", middlewares.AuthTokenAdmin(), admin.ShopGroupList)
	//分组排序
	r.POST("/admin/shopGroup/Sort", middlewares.AuthTokenAdmin(), admin.ShopGroupSort)
	// 新增/修改商品分组
	r.POST("/admin/shopGroup/add_or_edit", middlewares.AuthTokenAdmin(), admin.ShopGroupAdd)
	//删除商品分组
	r.POST("/admin/shopGroup/del", middlewares.AuthTokenAdmin(), admin.ShopGroupDel)
	//商品list
	r.POST("/admin/shopProduct/list", middlewares.AuthTokenAdmin(), admin.GetShopProduct)
	//商品排序
	r.POST("/admin/shopProduct/Sort", middlewares.AuthTokenAdmin(), admin.ShopProducSort)
	// 新增/修改商品
	r.POST("/admin/shopProduct/add_or_edit", middlewares.AuthTokenAdmin(), admin.AddShopProduc)
	//批量删除商品
	r.POST("/admin/shopProduct/del", middlewares.AuthTokenAdmin(), admin.ShopProducDel)
	//批量商品上下架
	r.POST("/admin/shopProduct/status", middlewares.AuthTokenAdmin(), admin.ShopProducStatus)
	//服务商品list
	r.POST("/admin/fuwu_Product/list", middlewares.AuthTokenAdmin(), admin.GetFuwuProduct)
	// 新增/修改服务商品
	r.POST("/admin/fuwu_Product/add_or_edit", middlewares.AuthTokenAdmin(), admin.AddFuProduc)
	//服务商品排序
	r.POST("/admin/fuwu_Product/Sort", middlewares.AuthTokenAdmin(), admin.FuProducSort)
	//批量删除服务商品
	r.POST("/admin/fuwu_Product/del", middlewares.AuthTokenAdmin(), admin.FuProducDel)
	//批量服务商品上下架
	r.POST("/admin/fuwu_Product/status", middlewares.AuthTokenAdmin(), admin.FuProducStatus)
	//获取物流模版
	r.POST("/admin/freight/list", middlewares.AuthTokenAdmin(), admin.FreightList)
	//物流模版排序
	r.POST("/admin/freight/Sort", middlewares.AuthTokenAdmin(), admin.FreightSort)
	// 新增/修改物流模版
	r.POST("/admin/freight/add_or_edit", middlewares.AuthTokenAdmin(), admin.FreightAdd)
	//删除物流模版
	r.POST("/admin/freight/del", middlewares.AuthTokenAdmin(), admin.FreightDel)
	//获取服务区域
	r.POST("/admin/region/list", middlewares.AuthTokenAdmin(), admin.RegionList)
	//服务区域排序
	r.POST("/admin/region/Sort", middlewares.AuthTokenAdmin(), admin.RegionSort)
	// 新增/修改服务区域
	r.POST("/admin/region/add_or_edit", middlewares.AuthTokenAdmin(), admin.RegionAdd)
	//删除服务区域
	r.POST("/admin/region/del", middlewares.AuthTokenAdmin(), admin.RegionDel)
	//获取城市数据
	r.POST("/admin/city/list", middlewares.AuthTokenAdmin(), admin.CityList)
	// 新增/修改市
	r.POST("/admin/city/add_or_edit", middlewares.AuthTokenAdmin(), admin.CityAdd)
	// 批量城市修改
	r.POST("/admin/city/edit", middlewares.AuthTokenAdmin(), admin.CityEdit)
	//获取热门搜索
	r.POST("/admin/hot_search/list", middlewares.AuthTokenAdmin(), admin.HotSearchList)
	// 新增/修改热门搜索
	r.POST("/admin/hot_search/add_or_edit", middlewares.AuthTokenAdmin(), admin.HotSearchAdd)
	//删除热门搜索
	r.POST("/admin/hot_search/del", middlewares.AuthTokenAdmin(), admin.HotSearchDel)
	//获取文章分类
	r.POST("/admin/article/list", middlewares.AuthTokenAdmin(), admin.ArticleCategoryList)
	//文章分类排序
	r.POST("/admin/article/Sort", middlewares.AuthTokenAdmin(), admin.ArticleCateGorySort)
	// 新增/修改文章分类
	r.POST("/admin/article/add_or_edit", middlewares.AuthTokenAdmin(), admin.ArticleCateGoryAdd)
	//删除文章分类
	r.POST("/admin/article/del", middlewares.AuthTokenAdmin(), admin.ArticleCateGoryDel)
	//获取文章
	r.POST("/admin/articleContent/list", middlewares.AuthTokenAdmin(), admin.ArticleList)
	//文章排序
	r.POST("/admin/articleContent/Sort", middlewares.AuthTokenAdmin(), admin.ArticleSort)
	// 新增/修改文章
	r.POST("/admin/articleContent/add_or_edit", middlewares.AuthTokenAdmin(), admin.ArticleAdd)
	//删除文章
	r.POST("/admin/articleContent/del", middlewares.AuthTokenAdmin(), admin.ArticleDel)
	//获取支付设置
	r.POST("/admin/pay_set/list", middlewares.AuthTokenAdmin(), admin.PaySetList)
	// 新增/修改支付设置
	r.POST("/admin/pay_set/add_or_edit", middlewares.AuthTokenAdmin(), admin.PaySetAdd)
	//删除支付设置
	r.POST("/admin/pay_set/del", middlewares.AuthTokenAdmin(), admin.PaySetDel)
	//获取充值赠送
	r.POST("/admin/recharge_set/info", middlewares.AuthTokenAdmin(), admin.RechargeList)
	//设置充值赠送
	r.POST("/admin/recharge_set/edit", middlewares.AuthTokenAdmin(), admin.RechargeAdd)
	//获取服务项目
	r.POST("/admin/fu_shop/list", middlewares.AuthTokenAdmin(), admin.FuShopList)
	// 新增/修改服务项目
	r.POST("/admin/fu_shop/add_or_edit", middlewares.AuthTokenAdmin(), admin.FuShopAdd)
	//删除服务项目
	r.POST("/admin/fu_shop/del", middlewares.AuthTokenAdmin(), admin.FuShopDel)
	//获取充值卡
	r.POST("/admin/recharge_exchange/list", middlewares.AuthTokenAdmin(), admin.RechargeExchangeList)
	// 新增/修改充值卡
	r.POST("/admin/recharge_exchange/add_or_edit", middlewares.AuthTokenAdmin(), admin.RechargeExchangeAdd)
	//删除充值卡
	r.POST("/admin/recharge_exchange/del", middlewares.AuthTokenAdmin(), admin.RechargeExchangeDel)
	//获取优惠券
	r.POST("/admin/coupon/list", middlewares.AuthTokenAdmin(), admin.CouponList)
	// 新增/修改优惠券
	r.POST("/admin/coupon/add_or_edit", middlewares.AuthTokenAdmin(), admin.CouponAdd)
	//删除优惠券
	r.POST("/admin/coupon/del", middlewares.AuthTokenAdmin(), admin.CouponDel)
	//获取注册赠送
	r.POST("/admin/register_giveset/info", middlewares.AuthTokenAdmin(), admin.GetRegisterGiveset)
	//设置注册赠送
	r.POST("/admin/register_giveset/edit", middlewares.AuthTokenAdmin(), admin.EditRegisterGiveset)
	//获取服务订单列表
	r.POST("/admin/fu_order/list", middlewares.AuthTokenAdmin(), admin.GetFuOrderList)
	//修改订单备注
	r.POST("/admin/fu_order/edit", middlewares.AuthTokenAdmin(), admin.EditFuOrderRemark)
	//获取捐助记录
	r.POST("/admin/juan/list", middlewares.AuthTokenAdmin(), admin.JuanzengList)
	//批量修改颁发证书
	r.POST("/admin/juan/edit", middlewares.AuthTokenAdmin(), admin.JuanType)
	//获取预约单
	r.POST("/admin/yuyue/list", middlewares.AuthTokenAdmin(), admin.GetFuYue)
	//派单
	r.POST("/admin/yuyue/edit", middlewares.AuthTokenAdmin(), admin.PaiDan)
	//批量完成预约
	r.POST("/admin/yuyue/engOrder", middlewares.AuthTokenAdmin(), admin.EngYeYue)
	//// 商户分类list
	r.POST("/admin/business/cate/list", middlewares.AuthTokenAdmin(), admin.BusinessCateList)
	//// 商户分类新增or修改
	r.POST("/admin/business/cate/add_or_edit", middlewares.AuthTokenAdmin(), admin.BusinessCateAdd)
	//// 删除商户分类
	r.POST("/admin/business/cate/del", middlewares.AuthTokenAdmin(), admin.BusinessCateDel)
	//// 绑定商品分类
	r.POST("/admin/business/cate/ShopCate", middlewares.AuthTokenAdmin(), admin.BusinessCateShopCate)
	// 商户获取列表
	r.POST("/admin/business/list", middlewares.AuthTokenAdmin(), admin.BusinessList)
	// 商户新增or修改
	r.POST("/admin/business/add_or_edit", middlewares.AuthTokenAdmin(), admin.BusinessAdd)
	//商户删除
	r.POST("/admin/business/del", middlewares.AuthTokenAdmin(), admin.BusinessDel)
	// 暂停营业
	r.POST("/admin/business/stop", middlewares.AuthTokenAdmin(), admin.BusinessStop)
	//// 获取意见列表
	r.POST("/admin/opinion/list", middlewares.AuthTokenAdmin(), admin.OpinionList)
	//// 修改意见
	r.POST("/admin/opinion/add_or_edit", middlewares.AuthTokenAdmin(), admin.OpinionEdit)
	//// 获取短信模版
	r.POST("/admin/sms_model/list", middlewares.AuthTokenAdmin(), admin.SmsModelList)
	//// 修改短信模版
	r.POST("/admin/sms_model/add_or_edit", middlewares.AuthTokenAdmin(), admin.SmsModelAdd)

	//新增省份
	r.POST("/admin/m_province/add", admin.AddCity)
	return r
}
